<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>购买商品</title>
    {% load static %}
    <link rel="stylesheet" type="text/css" href="{% static 'sop/style_6.css' %}" />
</head>
<body>
<div class="all_div">
	<div class="show_menu">
		<p><a href="{% url 'sop:log' user.id %}">返回</a></p>
		<p> <a href="{% url 'sop:page' user.id pages %}" class="page">上一页</a></p>
	    <p> <a href="{% url 'sop:next' user.id pages %}" class="next">下一页</a></p>
		<p>{{user.user_RMB}}</p>
	    {% if succeed %}
	     <p class="succeed">{{succeed}}</p>
		{% endif %}
		
	</div>
	<div class="show_goods">
		{% if goods %}
	    {% for goods_all in goods %}
	        <form action="{% url 'sop:shops' user.id pages %}" method="post" class="form_1">
				{% csrf_token %}
				
				<ul>
					<li>商品名称：{{goods_all.goods_name}}</li>
					<li>商品编号：<input type="text" name="goods_id" value="{{goods_all.goods_id}}" class="id" readonly="true"></li>
					<li>商品分类：{{goods_all.goods_class}}</li>
					<li>商品库存：{{goods_all.goods_stock}}</li>
					<li>添加时间：{{goods_all.goods_time}}</li>
					<li>购买数量： <input type="text" name="stock" value="1" class="stock"></li>
				</ul>	          
					<p class="price">{{goods_all.goods_price}}$</p>
					<input type="submit" value="购买" class="buy" id="buy">
	        </form>
	        <form action="{% url 'sop:cart' user.id pages%}" method="post" class="form_2">
	            {% csrf_token %}
	            <input type="text" value="{{goods_all.goods_id}}" name="goods_id" class="goods_id">
	            添加数量： <input type="text" name="stock" class="stock">
	            <input type="submit" value="添加到购物车" class="cart" id="cart">
	        </form>
	    {% endfor %}
	{% endif %}
	</div>
	
	
</div>

<script type="text/javascript">
	var a = document.getElementById("buy")
	a.onclick = function (){
		
			alert('{{succeed}}')
		
	}
	var b = document.getElementById("cart")
	b.onclick = function (){
		
			alert('{{succeed}}')
		
	}
</script>

</body>
</html>